package com.mobile.persistent.entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.mobile.persistent.base.BaseEntity;

@Entity
@Table(name="users")
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true)
public class Users extends BaseEntity{
	private static final long serialVersionUID = 1L;
	private String userName;
	private String passWord;
	
	private List<UserPurview> userPurviews;// 用户权限
	
	@Column(name="userName", columnDefinition="varchar(50)")
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	@Column(name="password", columnDefinition="varchar(50)")
	public String getPassWord() {
		return passWord;
	}
	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}
	@OneToMany(mappedBy="user", fetch=FetchType.LAZY)
	@org.hibernate.annotations.Fetch(org.hibernate.annotations.FetchMode.SUBSELECT)
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE,
		org.hibernate.annotations.CascadeType.DELETE,
		org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
	public List<UserPurview> getUserPurviews() {
		return userPurviews;
	}
	public void setUserPurviews(List<UserPurview> userPurviews) {
		this.userPurviews = userPurviews;
	}
	
}
